<template>
    <div class="scrollnav" :style="[{'top':top}]">
        <div class="nav_left">
            <div @click="$router.push(`/pages/home/${item.post_type_id}`)" :class="[{'active':path == item.post_type_id},'tab']" v-for="(item,index) in list" :key="index">{{item.post_type_name}}</div>
        </div>
    </div>
</template>

<script>
export default {
    components: {},
    props: {
        list: {
            type: Array,
            default: () => [
                
            ]
        },
        top: {
            type: String,
            default: '0'
        }
    },
    data() {
        return {
            // path: this.$route.params.id
        }
    },

    methods: {},
    watch: {},
    mounted() {
        /*var index = sessionStorage.getItem("index");*/
    },
    created() {},
    computed: {
        path() {
            return this.$route.params.id
        }
    }
}
</script>

<style scoped>
.scrollnav {
    display: flex;
    position: fixed;
    z-index: 99;
    width: 100%;
    height: 1rem;
    justify-content: space-between;
    /* top: 0; */
    background: #fff;
    border-bottom: solid 0.5px rgba(100, 100, 100, 0.2);
}
.nav_right {
    width: 1rem;
    height: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.48rem;
}
.box {
    /* position: absolute; */
}
.nav_left {
    width: calc(100% - 1rem);
    white-space: nowrap;
    display: -webkit-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}
.nav_left .tab {
    padding: 0 0.24rem;
    font-size: 0.32rem;
    color: rgba(0, 0, 0, 0.54);
    flex: 1;
    display: inline-block;
    position: relative;
    height: inherit;
    height: 100%;
    line-height: 1rem;
}
.nav_left::-webkit-scrollbar {
    display: none;
}
.nav_left .active {
    color: #be2328;
    font-size: 0.36rem;
}
</style>